#include <stdio.h>
int main(void)
{
    printf("Enter a sentence: ");
    char ch;
    int count = 0, all_length = 0, word_length = 0;
    do {
        ch = getchar();
        if (ch == ' ' || ch == '\n') {
            if (word_length) {
                count++;
                all_length += word_length;
                word_length = 0;
            }
        } else
            word_length++;
    } while (ch != '\n');
    printf("Average word length: %.1f\n", (float)all_length / count);
    return 0;
}